﻿#region Header

// AmmoContainer.cs

#endregion Header

namespace fpsrpg
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// The ammo container i where a player keeps his ammo. It stores the amounr of ammo availble for the diffrent kinds of weapons.
    /// </summary>
    public class AmmoContainer
    {
        #region Fields

        /// <summary>
        /// Array containing the amount of ammo store for each ammo type
        /// </summary>
        private uint[] Ammo = new uint[(int)AmmoType._Count];

        #endregion Fields

        #region Methods

        /// <summary>
        /// Gets the amount of ammo avaible for the type of ammo passed in.
        /// </summary>
        /// <param name="at">The type of ammo to count</param>
        /// <returns>uint, The amount of ammo available for that certain type of ammo</returns>
        public uint ForType(AmmoType at)
        {
            return Ammo[(int)at];
        }

        /// <summary>
        /// Adds the amount of ammo passed in to the total amount of ammo of the passed in kind
        /// </summary>
        /// <param name="at">The type of the ammo to be added.</param>
        /// <param name="amount">the amount of bullets to add</param>
        public void Pickup(AmmoType at, uint amount)
        {
            Ammo[(int)at] += amount;
        }

        /// <summary>
        /// Removes the passed in amount from the total count of bullet available for the passed in kind
        /// </summary>
        /// <param name="at">The type of ammo to be removed</param>
        /// <param name="amount">The amount of bullets to be removed</param>
        public void Remove(AmmoType at, uint amount)
        {
            Ammo[(int)at] -= amount;
        }

        #endregion Methods
    }
}